define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'ydcaiwushow/index' + location.search,
                    add_url: 'ydcaiwushow/add',
                    edit_url: 'ydcaiwushow/edit',
                    del_url: 'ydcaiwushow/del',
                    multi_url: 'ydcaiwushow/multi',
                    import_url: 'ydcaiwushow/import',
                    table: 'ydcaiwushow',
                }
            });

            var table = $("#table");
            $.fn.bootstrapTable.locales[Table.defaults.locale]['formatShowingRows'] = function (pageFrom, pageTo, totalRows) {
                return ' ';
            };
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                pageList: ['50'],
                showExport: false,
                searchFormVisible: true,
                showToggle: false,
                showColumns: false,
                search:false,
                columns: [
                    [
                        //{checkbox: true},
                        //{field: 'id', title: __('Id')},
                        {field: 'ctype', title: __('Ctype'), searchList: {"1":__('Ctype 1'),"2":__('Ctype 2'),"0":__('Ctype 0')}, formatter: Table.api.formatter.normal, operate: false},
                        {field: 'shouru', title: __('Shouru'), operate: false},
                        {field: 'yue1', title: __('Yue1'), operate: false},
                        {field: 'yue2', title: __('Yue2'), operate: false},
                        {field: 'yue3', title: __('Yue3'), operate: false},
                        {field: 'yue4', title: __('Yue4'), operate: false},
                        {field: 'yue5', title: __('Yue5'), operate: false},
                        {field: 'yue6', title: __('Yue6'), operate: false},
                        {field: 'yue7', title: __('Yue7'), operate: false},
                        {field: 'yue8', title: __('Yue8'), operate: false},
                        {field: 'yue9', title: __('Yue9'), operate: false},
                        {field: 'yue10', title: __('Yue10'), operate: false},
                        {field: 'yue11', title: __('Yue11'), operate: false},
                        {field: 'yue12', title: __('Yue12'), operate: false},
                        {field: 'year', title: __('Year'), searchList: {"2023":"2023","2024":"2024","2025":"2025","2026":"2026","2027":"2027","2028":"2028"}, operate: 'LIKE'},
                        {field: 'heji', title: __('合计'), operate: false},
                        //{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        //{field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        //{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
